#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.urls import path
from django.views.decorators.csrf import csrf_exempt
from rest_framework.routers import SimpleRouter

from .views import (VehicleInfoModelViewSet, VehicleFaultInfoModelViewSet, VehicleInfoRealDataView, VehicleFaultLogModelViewSet, 
                    VehicleFenceModelViewSet, VehicleMoveInfoModelViewSet, VehicleMovePathStartView, VehicleInfoHistoryDataView, 
                    VehicleInfoIndexDataView)

# 创建一个SimpleRouter实例
router = SimpleRouter()

# 注册VehicleInfoModelViewSet到路由，路径为"api/vehicle"
router.register("api/vehicle", VehicleInfoModelViewSet)

# 注册VehicleMoveInfoModelViewSet到路由，路径为"api/vehicle_move"
router.register("api/vehicle_move", VehicleMoveInfoModelViewSet)

# 注册VehicleFaultInfoModelViewSet到路由，路径为"api/vehicle_fault"
router.register("api/vehicle_fault", VehicleFaultInfoModelViewSet)

# 注册VehicleFaultLogModelViewSet到路由，路径为"api/vehicle_fault_log"
router.register("api/vehicle_fault_log", VehicleFaultLogModelViewSet)

# 注册VehicleFenceModelViewSet到路由，路径为"api/vehicle_fence"
router.register("api/vehicle_fence", VehicleFenceModelViewSet)

# 定义urlpatterns列表
urlpatterns = [
    # 添加一个路径，用于获取车辆实时数据，路径为'api/vehicle_info/real_data/<str:vin>'
    path('api/vehicle_info/real_data/<str:vin>', VehicleInfoRealDataView.as_view()),

    # 添加一个路径，用于获取车辆历史数据，路径为'api/vehicle_info/history_data/<str:vin>'
    path('api/vehicle_info/history_data/<str:vin>', VehicleInfoHistoryDataView.as_view()),

    # 添加一个路径，用于获取车辆索引数据，路径为'api/vehicle_info/index_data/'
    path('api/vehicle_info/index_data/', VehicleInfoIndexDataView.as_view()),

    # 添加一个路径，用于启动车辆移动路径，路径为'api/vehicle_move_path/start/'
    path('api/vehicle_move_path/start/', VehicleMovePathStartView.as_view()),
]

# 将router的urls添加到urlpatterns列表中
urlpatterns += router.urls

